<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<!--{$CHARSET}-->" />
	<title><!--{$title}--> -<!--{$config_core.seo_title}--></title>
	<meta name="keywords" content="<!--{$config_core.head_keywords}-->" />
	<meta name="description" content="<!--{$config_core.head_description}-->" />
	<meta http-equiv="x-ua-compatible" content="ie=7" />
	<meta name="generator" content="CityBao System" />
	<meta name="author" content="www.citybao.net" />
	<link href="<!--{$INSTALL_PATH}-->favicon.ico" rel="shortcut icon" />
	<link href="<!--{$INSTALL_PATH}-->favicon.ico" rel="bookmark" />
	<link href="<!--{$CSS_DIR}-->citybao.css" rel="stylesheet" type="text/css" />
	<link href="<!--{$CSS_DIR}-->member.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" language="javascript">
		var CB_CssPath = '<!--{$CSS_DIR}-->';
		var CB_ImgPath = '<!--{$IMG_DIR}-->';
		var CB_JsPath  = '<!--{$JS_DIR}-->';
		<!--{if $SAFE_DOMAIN != ''}-->
		document.domain = '<!--{$SAFE_DOMAIN}-->';
		<!--{/if}-->
	</script>
	<script type="text/javascript" src="<!--{$JS_DIR}-->jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="<!--{$JS_DIR}-->common.js"></script>
	<script type="text/javascript" src="<!--{$JS_DIR}-->Dialog.js"></script>
</head>
<body>
<!--{include file='header.tpl'}-->
<!--{assign var='guide_suffix' value='会员注册'}-->
<!--{include file='guide.tpl'}-->
<div id="container" class="clearfix">
	<div class="fillet filletColor7 marginTop5">
		<b class="fillet1"></b><b class="fillet2"></b><b class="fillet3"></b><b class="fillet4"></b>
		<div class="filletContent">
		<!--{if $part=='form'}-->
			<div class="main_top">
				<ul class="step">
					<li class="step1_c"></li>
					<li class="steparrow"></li>
					<li class="step2"></li>
				</ul>
	  		</div>
			<div class="main_body marginTop10">
				<div class="fRed tCenter" id="error"><!--{$error}--></div>
				<form action="" method="post" name="userReg" id="userReg">
				<input type="hidden" name="forward" value="<!--{$forward}-->" id='forward' />
				<input type="hidden" name="validate" value="<!--{$validate}-->" />
				<p class="reg_title">创建您的帐号</p>
				<dl class="formList">
					<dd>
						<div class="colum_left">
							用户名：<span class="fRed">*</span>
						</div>
						<div class="colum_right">
	    					<div class="inputbox">
								<span class="input">
									<cite><input id="username" name="username" type="text" maxlength="17" alt="用户名:errArea{usernametip}" value="<!--{$username}-->" /></cite>
								</span>
							</div>
							<span id="usernametip" class="tip"></span>
							<div class="inputtip fGray">4-16位之间，请用英文小写、数字、下划线、英文句点，只能以字母开头</div>
						</div>
					</dd>
				</dl>
				<p class="reg_title">安全信息设置</p>
				<dl class="formList">
					<dd>
						<div class="colum_left">
							登录密码：<span class="fRed">*</span>
						</div>
						<div class="colum_right">
	    					<div class="inputbox">
								<span class="input">
									<cite><input id="password" name="password" type="password" alt="密码:errArea{passwordtip}" value="" /></cite>
								</span>
							</div>
							<span class="inputfloat" id="passW">
								<div class="passW" id="passW1"><span class="passW_w"></span><span class="passW_t">弱</span></div>
								<div class="passW" id="passW2"><span class="passW_w"></span><span class="passW_t">中</span></div>
								<div class="passW" id="passW3"><span class="passW_w"></span><span class="passW_t">强</span></div>
							</span>
							<span id="passwordtip" class="tip"></span>
							<div class="inputtip fGray">6-20个字符，区分大小写，推荐使用数字、字母和特殊符号组合</div>
						</div>
					</dd>
					<dd>
						<div class="colum_left">
							确认密码：<span class="fRed">*</span>
						</div>
						<div class="colum_right">
	    					<div class="inputbox">
								<span class="input">
									<cite><input id="password2" name="password2" type="password" alt="确认密码:errArea{password2tip}"  value="" /></cite>
								</span>
							</div>
							<span id="password2tip" class="tip"></span>
						</div>
					</dd>
					<dd>
						<div class="colum_left">
							E-mail地址：<span class="fRed">*</span>
						</div>
						<div class="colum_right">
	    					<div class="inputbox">
								<span class="input">
									<cite><input id="email" name="email" type="text" maxlength="37" alt="邮箱名:errArea{emailtip}" value="<!--{$email}-->" /></cite>
								</span>
							</div>
							<span id="emailtip" class="tip"></span>
							<div class="inputtip fGray">请输入有效的邮件地址，当密码遗失时凭此领取</div>
						</div>
					</dd>
				</dl>
				<!--{if $captcha_register == 1}-->
				<p class="reg_title">注册验证</p>
				<dl class="formList">
					<dd>
						<div class="colum_left">
							验证码：<span class="fRed">*</span>
						</div>
						<div class="colum_right">
	    					<div class="inputbox">
								<span class="input">
									<cite><input autocomplete="off" id="captcha" name="captcha" type="text" maxlength="10" alt="验证码:errArea{captchatip}" value=""  /></cite>
								</span>
							</div>
							<span id="captcha_img" class="hide">
								<span><img id="check_img" src="" /></span>
								<span class="blueA"><a href="javascript:get_captcha();">看不清</a>？</span>
							</span>
							<span id="captchatip" class="tip"></span>
						</div>
					</dd>
				</dl>
				<!--{/if}-->
				<p class="reg_title">服务条款</p>
				<dl class="formList">
					<dd>
						<div class="colum_left"></div>
						<div class="colum_right"><input id="after" name="after" type="checkbox" alt="我已阅读并接受“服务条款”:条款/errArea{aftertip}" checked="checked" />&nbsp;我已阅读并接受“<span class="blueA"><a href="agreement.php" target="_blank"
						 title="服务条款">服务条款</a></span>”</div>
					</dd>
					<dd>
						<div class="colum_left"></div>
						<div class="colum_right">
							<input type="submit" class="btn_submit" value="提交" />
						</div>
					</dd>
				</dl>
				</form>
			</div>
			<!--{elseif $part=='success'}-->
			<div class="main_top">
				<ul class="step">
					<li class="step1"></li>
					<li class="steparrow"></li>
					<li class="step2_c"></li>
				</ul>
	  		</div>
			<div class="main_body marginTop10">
				<p class="reg_title1"></p>
				<h2 class="fOrange tCenter fYahei">恭喜您！<!--{$SITE_NAME}-->会员注册成功！</h2>
				<p style="margin:40px auto auto 250px; color:#FF9900; ">以下是您的注册信息，请务必牢记</p>
				<ul class="reg_info">
					<li>您的用户名：<span class="fb"><!--{$username}--></span></li>
					<li>您的密码：<span class="fb"><!--{$password}--></span></li>
					<li>您的电子邮箱：<span class="fb"><!--{$email}--></span></li>
				</ul>
				<p class="marginTop5 tCenter">
				<!--{if $after_register_login == 0}-->
					<span class="blueA marginRight10"><a href="<!--{$INSTALL_PATH}-->member/">进入会员中心</a></span>
					<span class="blueA marginRight10 marginLeft10"><a href="">完善会员资料</a></span>
				<!--{else}-->
					<span class="blueA marginRight10"><a href="<!--{$INSTALL_PATH}-->member/login.php">现在就去登录</a></span>
				<!--{/if}-->
					<span class="blueA marginRight10 marginLeft10"><a href="<!--{$forward}-->">返回注册前页面</a></span>
					<span class="blueA marginLeft10"><a href="<!--{$INSTALL_PATH}-->">返回首页</a></span>
				</p>
				<div class="btn_s_c"><a href="javascript:window.close(this)">关闭本页</a></div>
			</div>
			<!--{/if}-->
		</div>
		<b class="fillet5"></b><b class="fillet6"></b><b class="fillet7"></b><b class="fillet8"></b>
	</div>
</div>
 
<script type="text/javascript">
	$(function() {
		//输入框样式
		$(':text,:password')
			.each(function(){
				if($(this).attr('id') == 'password'){
					$(this).bind('keyup',chkKeyboard);
					$(this).bind('keydown',chkKeyboard);
				}else if($(this).attr('id') == 'captcha'){
					$(this).addClass('fGray');
					$(this).attr('value','点击这里显示验证码');
				}
			})
			.focus(function(){
				node = $(this).parents('span.input')
				node.removeClass('inputRed');
				node.addClass('inputGreen');
				showError($(this),'clear');
				if($(this).attr('id') == 'password'){
					$('#passW').show();
				}else if($(this).attr('id') == 'captcha'){
					if($(this).attr('value') == '点击这里显示验证码'){
						$(this).removeClass('fGray');
						$(this).attr('value','');
					}
					if($("#captcha_img").is(":hidden")){
						$("#captcha_img").show();
						get_captcha();
					}
				}
			}).blur(function(){
				node = $(this).parents('span.input')
				node.removeClass('inputGreen');
				validate($(this));
			});
	});
	
	//表单提交验证
	$("#userReg").submit(function(){
		var flag=true;
		$("input:visible").each(function(){
			if($(this).val()==''){
				Dialog("提示","text:请完善表单后再提交！","400","150",true,"",true);
				flag = false;
				return false;
			}
		});
		if(!$("#after").is(":checked")){
			flag = false;
			Dialog("提示","text:同意本站的服务条款后才能注册！<br />请在表单的“我已阅读并接受服务条款”前打勾。","400","150",true,"",true);
		}
		return flag;
	});
	
	/**
	 * 验证表单
	 */
	function validate(e){
		var msg = 'custom';
		$.ajaxSetup({
			url:'<!--{$INSTALL_PATH}-->ajax.php',
			type: "POST"
		});
		
		if(e.attr('name') == 'username'){
			msg = checkUsername(e.val());
			if(msg == 'hide')
				checkUsernameExist(e);
		}
		if(e.attr('name') == 'password'){
			msg = checkPassword(e.val());
		}
		if(e.attr('name') == 'password2'){
			msg = checkPassword2(e.val());
		}
		if(e.attr('name') == 'email'){
			msg = checkEmail(e.val());
			if(msg == 'hide')
				checkEmailExist(e);
		}
		if(e.attr('name') == 'captcha'){
			msg = checkCaptcha(e.val());
			if(msg == 'hide')
				checkCaptchaAjax(e);
		}

		showError(e,msg);
	}
	
	/**
	 * 检验用户名的可用性
	 */
	function checkUsernameExist(e){
		var username = e.val();
		$.ajax({data:'action=user-exist&username='+username,success:function(responseText){
			if(responseText.search("no")>=0){
				msg = 'hide';
			}else if(responseText.search("yes")>=0){
				msg = '用户名已被占用';
			}else{
				msg = '异步通信错误';
			}
			showError(e,msg);
		}});
	}
		 	
	/**
	 * 检验两次输入密码是否相同
	 */
	 function checkPassword2(str){
	 	var password = $("#password").val();
		if(str == '')
			return '密码不能为空！';
	 	if(str !== password)
			return '两次输入密码不一致！';;
		return 'hide';
	 }
		
	/**
	 * 检验邮箱地址的可用性
	 */
	function checkEmailExist(e){
		var email = e.val();
		$.ajax({data:'action=email-exist&email='+email,success:function(responseText){
			if(responseText.search("no")>=0){
				msg = 'hide';
			}else if(responseText.search("yes")>=0){
				msg = '邮箱地址已被注册，请更换！';
			}else{
				msg = '异步通信错误';
			}
			showError(e,msg);
		}});
	}
	 
	 /**
	  * 检验验证码是否为空
	  */
	 function checkCaptcha(str){
	 	if(str == '')
			return '请输入验证码！';
		return 'hide';
	 }
	 /**
	  * 检验验证码是否正确
	  */
	 function checkCaptchaAjax(e){
	 	var code = e.val();
		$.ajax({data:'action=check-captcha&code='+code,success:function(responseText){
			if(responseText.search("yes")>=0){
				msg = 'hide';
			}else if(responseText.search("no")>=0){
				msg = '验证码输入错误！';
			}else{
				msg = '异步通信错误';
			}
			showError(e,msg);
		}});
	 }
	
	function get_captcha() {
		var qq = Math.round((Math.random()) * 100000000);
		$.ajax({
			beforeSend:function(XHR){
				$("#check_img").attr('src', CB_ImgPath+"ajaxloading.gif");
			},
			error:function(){
				$("#captcha_img").html("<span class='fRed'>加载数据出错...</p>");
			},
			success:function(html){
				$("#check_img").attr('src', '<!--{$INSTALL_PATH}-->ajax.php?action=captcha&r=' + qq);
			}
		});
	}
</script>
<!--{include file='footer.tpl'}-->
</body>
</html>